import { Component, OnInit } from '@angular/core';
import { TodoStatus, TodoList, DataFlowPracticeService } from '../data-flow-practice.service';
import { DetailServiceSubject, ItemDetailService } from './item-detail.service';
import { Router, ActivatedRoute } from '@angular/router';

@Component({
  selector: 'app-item-detail',
  templateUrl: './item-detail.component.html',
  styleUrls: ['./item-detail.component.less']
})
export class ItemDetailComponent implements OnInit {
  isLoading: boolean;
  todoStatus: TodoStatus;
  detail: TodoList;
  detailSubject$: DetailServiceSubject;
  constructor(
    private router: Router,
    private route: ActivatedRoute,
    private detailService: ItemDetailService,
    private dataFlowService: DataFlowPracticeService) {
    this.detailSubject$ = this.detailService.getDetailSubject();
    this.detailSubject$.subscribe(this.updateDetail);
  }

  ngOnInit(): void {
    const newId = this.route.snapshot.paramMap.get('id');
    this.isLoading = true;
  }
  updateDetail = (data: TodoList) => {
    this.detail = data;
    this.isLoading = false;
  }
  change = () => {

  }
  changeStatus = (event: Event) => {

  }
  changeValue = (event: Event) => {

  }
}
